﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;


namespace VCommonUtils.UIUtils
{
    public static class ShellIcons
    {

        #region --CONST--
        private const int _floppy 			=	54 ;// 7;
        private const int _hard 			=	8;
        private const int _net				=	9;
        private const int _CD 				=	11;
        private const int _RAM 				=	12;
        private const int _unknown 			=	53;
        private const int _moveToDisk		=	321;
        private const int _edit				=	269;

        const string ShellIconsLib = @"C:\WINDOWS\System32\shell32.dll";

        #endregion

        #region --PRIVATE--
        
        [DllImport("shell32.dll",EntryPoint = "ExtractIcon")]
        extern static IntPtr ExtractIcon(IntPtr hInst,string lpszExeFileName,int nIconIndex);

        static public Icon GetIcon(int index)
        {
            IntPtr hIcon = ExtractIcon(IntPtr.Zero, ShellIconsLib, index);
            Icon icon = Icon.FromHandle(hIcon);
            return icon;
        }
        #endregion

        #region --PUBLIC--
        static public Icon EditDocument
        {
        	get {return GetIcon(_edit);}
        }
        
        static public Icon MoveToDisk
        {
        	get {return GetIcon(_moveToDisk);}
        }
        
        static public Icon FloppyDisk
        {
            get { return GetIcon(_floppy); }
        }

        static public Icon HardDisk
        {
            get { return GetIcon(_hard); }
        }

        static public Icon NetDisk
        {
            get { return GetIcon(_net); }
        }

        static public Icon CDROM
        {
            get { return GetIcon(_CD); }
        }

        static public Icon RamDisk
        {
            get { return GetIcon(_RAM); }
        }

        static public Icon UnknownDisk
        {
            get { return GetIcon(_unknown); }
        }
        #endregion
        
        #region --EXTENSION--
        
        
        #endregion
    }
}
